//
//  ZMD5.m
//  Test
//
//  Created by 徐益智 on 16/4/10.
//  Copyright © 2016年 Vdianjing. All rights reserved.
//

#import "ZMD5.h"
#import <CommonCrypto/CommonDigest.h>

@implementation ZMD5

/**
 *  md5加密 小写
 */
+ (NSString *)md5String:(NSString *)input {
    const char *str = input.UTF8String;
    unsigned char buffer[CC_MD5_DIGEST_LENGTH];
    
    CC_MD5(str, (CC_LONG)strlen(str), buffer);
    
    NSMutableString *strM = [NSMutableString string];
    for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i ++) {
        [strM appendFormat:@"%02x", buffer[i]];
    }
    
    return [strM copy];
}

@end
